package com;

import java.util.Scanner;

public class LoginPage {

	static boolean isLogin = false;// 登陆成功，标志设置为true
	public static void login(int id) {
		System.out.println("[会员系统>>登陆]");
		if (RegPage.isRegister == true) {
			System.out.println("请输入用户名：");
			Scanner input_name = new Scanner(System.in);
			String name = input_name.nextLine();

			System.out.println("请输入密码：");
			Scanner input_pwd = new Scanner(System.in);
			String pwd = input_pwd.nextLine();
			
			if (RegPage.userName.equals(name) && RegPage.passwd.equals(pwd)) {
				System.out.println("**********************************");
				System.out.println("\t欢迎" + name + "登陆系统!");
				System.out.println("**********************************");
				System.out.println("你的会员卡号是："+RegPage.cardNumber);
				isLogin = true;
				LuckyPage.goDraw(id+1);
			}else{
				System.out.println("账号密码错误，已退出！");
			}
		}else {
			System.out.println("请先注册,再登陆!");
			String answer = Temp.todo();
			if ("n".equals(answer)) {
				System.out.println("***********************");
				System.out.println("系统退出,谢谢使用!");
			}else if ("y".equals(answer)) {
				RegPage.reg(id-1);
			}
		}	
	}
}
